home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / time / tptcron / tptcron.doc < prev    next >
Text File  |  1990-03-29  |  19KB  |  486 lines

  1. TPTCron - CRON utility for the Amiga
  2.  
  3. TPTCron is a utility which executes AmigaDos tasks at regularly scheduled
  4. times. TPTCron is capable of executing periodic events - tasks which must be
  5. executed at specific time intervals. It is also capable of executing one-
  6. shot tasks, scheduled through the use of an external command called
  7. CronEvent. These one-shot events can be scheduled "on-the-fly" once TPTCron
  8. has been started up.
  9.  
  10. TPTCron and CronEvent were written by Mike Oliphant.
  11.  
  12. TelePro Technologies wishes to acknowledge the work of Steve R. Sampson for
  13. his initial PD cron, Rick Schaeffer who ported it to the Amiga, and
  14. Christian Balzer who swatted some bugs in Rick's code and created AmiCron2,
  15. the program upon which TPTCron is based.
  16.  
  17. Documentation by:  James Hastings-Trew
  18.               and  Mike Oliphant
  19. based on Rick and Christian's AmiCron2 documentation.
  20.  
  21. TPTCron is freeware - you are free to copy and distribute this program under
  22. the following conditions: the original archive and this documentation must
  23. be remain intact and unaltered, except for the inclusion of additional
  24. example CronTab files. This program must not be sold for profit or included
  25. in any commercial product without the express written permission of TelePro
  26. Technologies. TelePro Technologies will in no event be liable for any
  27. direct, indirect, or consequential damages to any equipment or software or
  28. data, arising from the use of this software; the entire risk as to its
  29. quality, performance, or fitness for any particular purpose is assumed by
  30. the end user.
  31.  
  32. ©1990 TelePro Technologies. All rights reserved.
  33.  
  34. TelePro Technologies,
  35. 20-1524 Rayner Avenue,
  36. Saskatoon, Saskatchewan,
  37. Canada,          S7N 1Y1
  38.  
  39.  
  40.  
  41.  
  42. TPTCRON
  43. ------------------------------------------------------------------------
  44. When TPTCron is first run it optionally reads a table of permanent,
  45. periodic events to run from a file called CronTab, which we suggest be
  46. located in your S: directory. TPTCron maintains this list of events to
  47. execute in RAM.
  48.  
  49. We suggest that TPTCron should run in it's own CLI window. This is
  50. suggested for two reasons:
  51.  
  52.     (1) The AmigaDOS commands that TPTCron executes need a place to
  53.         print output, display errors, etc.
  54.     (2) If you run TPTCron from your main CLI window, you could prevent
  55.         a cron event from being executed properly by typing into that
  56.         window.
  57.  
  58. If you do not wish to run TPTCron in it's own CLI window, you can RUN it
  59. from your main CLI, by re-directing it's output to NIL:. This will
  60. make it impossible to hold up a cron event by typing commands into that
  61. CLI, but it will also make it impossible to see any output from TPTCron
  62. or the programs it runs.
  63.  
  64.  
  65. The syntax of TPTCron is as follows:
  66.  
  67.   TPTCron [path:crontab]
  68.  
  69. If TPTCron is run with no pathname specified for a CronTab file, it will set
  70. itself up in memory, available for programming by CronEvent, with no list of
  71. permanent periodic events to execute.
  72.  
  73. To re-direct TPTCron's output to NIL:, in case you wish to run TPTCron from
  74. your main CLI, the syntax is as follows:
  75.  
  76.   TPTCron >NIL: [path:crontab]
  77.  
  78. To run TPTCron with the ability to execute periodic events, you must first
  79. use your favorite editor to create a "CronTab" file. The format of CronTab
  80. is very simple - it contains entries in the form of lines where each line
  81. has 6 fields and each field is separated by "white space" (either tabs or
  82. spaces) from it's neighbor. The fields are as follows:
  83.  
  84. Field | Name       | Range of legal values
  85. ------+------------+-----------------------------------------------
  86. 1     | Minute     | 0 - 59
  87. 2     | Hour       | 0 - 23  (0 = 12:00 a.m.  /  23 = 11:00 p.m.)
  88. 3     | Date       | 1 - 31
  89. 4     | Month      | 1 - 12  (1 = January  /  12 = December)
  90. 5     | Day        | 0 - 6   (0 = Sunday  /   6 = Saturday)
  91. 6     | Command    | This is the command to be run at the appointed
  92.       |            | time. It will be run just as if typed into
  93.       |            | the CLI.
  94.  
  95. Each entry for each of the first five fields should be a number in the legal
  96. range for that field. If you substitute an asterisk (*) for a number in a
  97. field it is taken to mean ALL possible numbers for that field. You may also
  98. specify a SET of values for each field, by separating them with commas.
  99. Similarly, you can specify a RANGE of values by separating them with a
  100. hyphen (-). For example:
  101.  
  102.   ------------------------------------------------------------------
  103.  
  104.   Print the date in the TPTCron CLI window every minute:
  105.  
  106. * * * * * DATE
  107.  
  108.   Since there are asterisks in each field, TPTCron takes
  109.   that to mean that at each legal interval, run the command DATE.
  110.   Since the smallest interval is a minute, the DATE command will
  111.   be executed every minute, regardless of the hour, date,
  112.   month, or day.
  113.  
  114.   ------------------------------------------------------------------
  115.  
  116.   Print the date in the TPTCron CLI window on the hour, every hour:
  117.  
  118. 0 * * * * DATE
  119.  
  120.   Since we have put a 0 in the minutes field, the command will now
  121.   only execute whenever the minutes equals 0 - once each hour.
  122.  
  123.   ------------------------------------------------------------------
  124.  
  125.   Run UUPC at 4:30 a.m. every day except Saturday and Sunday:
  126.  
  127. 30 4 * * 1-5 UUPC -siscuva
  128.  
  129.   Here we are asking to run an event when minutes equals 30,
  130.   hours equals 4 (which will be at 4:30 a.m.), any date,
  131.   any month, and only in the RANGE of days 1 to 5 (Monday to Friday).
  132.   Notice that we are running a command with command line parameters.
  133.   There is no need to quote commands that contain spaces - everything
  134.   after the fifth numeric field is taken to be one entire command string
  135.   to be executed.
  136.  
  137.   ------------------------------------------------------------------
  138.  
  139.   Incrementally backup the files every other day at 7:30 p.m.:
  140.  
  141. 30 19 * * 1,3,5 sdbackup -l -s LAST dh0: incbkup_1:
  142.  
  143.   Here we are asking for an event at 1930 (7:30 p.m.), any date
  144.   day, any month, but only on the SET of days 1, 3, and 5 (Monday,
  145.   Wednesday, and Friday).
  146.  
  147.   ------------------------------------------------------------------
  148.  
  149.   Backup the files on the 1st and 15th of each month at 1:00 am
  150.  
  151. 00 1 1,15 * * sdbackup -l dh0: SemiBkup_1:
  152.  
  153.   Here we are asking for an event at 1:00 a.m., on the SET of dates
  154.   1 and 15, any month, any day.
  155.  
  156.   ------------------------------------------------------------------
  157.  
  158. CronTab entries *MUST* be left justified starting in column 1 and each entry
  159. must contain 6 fields, each separated by spaces or tabs. There can be as
  160. many entries in the CronTab table as you like.
  161.  
  162. You may also put comments into your CronTab file, with the use of the "#"
  163. character. If the first column contains a "#", the line is considered to be
  164. a comment, and the rest of the line will be ignored by TPTCron.
  165.  
  166. The events that TPTCron schedules from the CronTab file are called PERMANENT
  167. events. If you wish to manipulate the permanent events once TPTCron is
  168. running, you must re-edit your CronTab file, or have a secondary CronTab
  169. file available, and use the CronEvent program (see below) to read the new
  170. CronTab file into TPTCron.
  171.  
  172.  
  173.  
  174.  
  175. CRONEVENT
  176. ------------------------------------------------------------------------
  177. Once TPTCron is running, you can create a list of ONE-SHOT events with a
  178. second program called CronEvent. The events which can be scheduled with
  179. CronEvent will only be executed once, after a given time interval. CronEvent
  180. can be used to list the pending one-shot events, add to the list, delete
  181. events from the list, or stop the TPTCron program. The format for the
  182. CronEvent command is as follows:
  183.  
  184. CronEvent (add|delete|list|read|tablist|when|quit) [minutes] [command]
  185.  
  186. The commands can be shortened to just the first letter of each command name.
  187. Here is an explanation of each command:
  188.  
  189. Add (a)
  190. -------
  191. When given the add command, CronEvent expects two more parameters to be
  192. given - the number of minutes to wait until executing the event, and the
  193. command to be executed. If the command to be executed has spaces or requires
  194. further command line parameters, it must be quoted.
  195. After the given number of minutes has expired, the command will be executed
  196. on the next minute mark. There is one special case for the number of minutes
  197. given to the add command - when the minutes parameter is zero, the event will
  198. occur immediately.
  199.  
  200. Syntax:
  201.     CronEvent a (minutes) (command)
  202.  
  203.  
  204. Delete (d)
  205. ----------
  206. When given the "delete" command, CronEvent expects one more parameter to be
  207. given - the name of the command to delete from the list. ALL occurrences of
  208. that particular command will be deleted from the list. For instance, if
  209. there were more than one DATE command in the list, then:
  210.     CronEvent d DATE
  211. would delete all pending DATE commands. You may use ARP style wildcards with
  212. the delete command. For instance:
  213.     CronEvent d D*
  214. would delete all pending events that start with the letter D,:
  215.     CronEvent d ~SI
  216. would delete all pending events except for SI.
  217. Please note: CronEvent will not delete pending PERMANENT events set up
  218. through the CronTab file.
  219.  
  220. Syntax:
  221.     CronEvent d (command)
  222.  
  223.  
  224. List (l)
  225. --------
  226. When given the "list" command, CronEvent requires no other parameters. The
  227. complete list of pending one-shot events will be printed in the TPTCron CLI
  228. window. Please note: the list command will not list pending PERMANENT events
  229. set up through the CronTab file. If you wish to view the list of permanent
  230. events, you should use the tablist command, explained below.
  231.  
  232.  
  233. Syntax:
  234.     CronEvent l
  235.  
  236.  
  237. Read (r)
  238. --------
  239. When given the "read" command, CronEvent optionally requires one more
  240. parameter - the name of a new CronTab file. The new CronTab file will
  241. replace the original table of pending PERMANENT events. If you give no
  242. pathname for a new CronTab file, CronEvent will attempt to read in the LAST
  243. CronTab file that you used. Failing that, it will look for the default
  244. pathname of S:CronTab, and load that file. If you wish to remove all
  245. pending permanent events, but do not wish to terminate TPTCron, then you
  246. will have to create a CronTab file that has no entries, and use the read
  247. command to load that into TPTCron.
  248.  
  249.  
  250. Syntax:
  251.     CronEvent r [path:crontab]
  252.  
  253.  
  254. Tablist (t)
  255. -----------
  256. When given the tablist command, CronEvent requires no other parameters. The
  257. complete list of pending PERMANENT events will be printed in the TPTCron CLI
  258. window. Please note: tablist will not list any pending one-shot events. If
  259. you wish to view the list of one-shot events, you should use the list
  260. command, explained above.
  261.  
  262.  
  263. Syntax:
  264.     CronEvent t
  265.  
  266.  
  267. When (w)
  268. --------
  269. When given the "when" command, CronEvent requires one more parameter to be
  270. given - the name of the command to list. For instance, if there was a
  271. DATE command in the list, then:
  272.     CronEvent w DATE
  273. would print when the pending DATE command would be executed in your
  274. current CLI. If there is more than one of that type of command in the list,
  275. the "when" command will only list the first one. Please note: CronEvent
  276. will not list pending PERMANENT events set up through the CronTab file.
  277.  
  278. Syntax:
  279.     CronEvent w (command)
  280.  
  281. Note: both LIST and WHEN will list event times as the exact minute mark
  282. at which they will occur. For instance, if we enter the command:
  283.     CronEvent a 5 si
  284. at the time 05:03:23, and then enter this command:
  285.     CronEvent l
  286. we will see the following report:
  287.  
  288.     TPTCron: List of pending events:
  289.     ================================
  290.     Time: Tue Mar  6 05:08 - Command: <si>
  291.  
  292. The original seconds are ignored, and the time is rounded backwards to the
  293. even minute mark.
  294.  
  295.  
  296. Quit (q)
  297. --------
  298. When given the "quit" command, CronEvent requires no other parameters. The
  299. TPTCron program will be immediately shut down, and all pending events will
  300. be cancelled. Alternatively, if you run TPTCron in its own CLI, then typing
  301. a CRTL-C in that CLI will also shut down the TPTCron program. This method
  302. will cause TPTCron to abort on the next minute mark. If you wish, you can
  303. also alternatively do a status command to find out what task number TPTCron
  304. has, and issue a "break <tasknumber>" command at the CLI to terminate its
  305. operation.
  306.  
  307. Syntax:
  308.     CronEvent q
  309.  
  310.  
  311.  
  312. SETUP
  313. ---------------------------------------------------------------------
  314.  
  315. CronEvent requires that the file "ARP.library" be located in your LIBS:
  316. directory. We have included the proper version of the ARP.library in the
  317. archive that the files came in.
  318.  
  319. To facilitate the correct operation of TPTCron, we have included three
  320. script files which should be copied to your S: directory. These are:
  321.     CronStart
  322.     TPTScript
  323.     CronTab
  324. CronStart is a batch file which will create a small CLI window, and execute
  325. a second script, TPTScript which will start up TPTCron in that new window.
  326. CronTab is a sample CronTab file which will print the date in that CLI every
  327. minute.
  328.  
  329. You should set the script bit for the CronStart file, especially if
  330. you are running WorkBench 1.3, and include a PATH to your S: directory.
  331.  
  332. In case your copy of the archive does not contain those script files, they
  333. are listed here:
  334.  
  335. CronStart:
  336. =========
  337. run newcli RAW:0/11/400/100/TPTCron S:TPTScript
  338.  
  339.  
  340. TPTScript:
  341. =========
  342. TPTCron S:CronTab
  343. endcli
  344.  
  345.  
  346. CronTab:
  347. =======
  348. * * * * * date
  349.  
  350.  
  351. We have also included a small batch file called Execute.ME which will copy
  352. all of the files used by TPTCron to the proper directories on your system.
  353.  
  354. Execute.ME:
  355. ===========
  356. copy TPTCron C:
  357. copy CronEvent C:
  358. copy CronStart S:
  359. protect S:CronStart +s  ;this assumes that you have Workbench 1.3 - remove
  360.                         ;this line if this is not the case.
  361. copy TPTScript S:
  362. copy CronTab S:
  363. copy ARP.library LIBS:  ;remove this line if your version of the ARP.library
  364.                         ;is more recent than 39.1
  365.  
  366.  
  367.  
  368. Programmer's Information
  369. ---------------------------------------------------------------------
  370. The CronEvent program communicates with the TPTCron program via a message
  371. port. It is therefore very easy to have other programs access TPTCron
  372. directly.  The following files have been included in this distribution to
  373. facilitate this process:
  374.  
  375.  
  376. _CronEvent.o:   A Manx 3.6a format object file.
  377. Cron.h:     An include file containing relevant #defines.
  378. CronTest.c: A sample program that communicates with TPTCron directly.
  379.  
  380.  
  381. _CronEvent.o contains a single routine, CronEvent(), that operates as
  382. follows:
  383.  
  384. (long) CronEvent((unsigned char)commandtype, (long)minutes, (char *)command)
  385.  
  386. Where 'commandtype' is one of the following values:
  387.  
  388.     #define ADDEVENT    1   /* Add an event */
  389.     #define DELEVENT    2   /* Delete an event */
  390.     #define LISTEVENTS  3   /* List the dynamic events */
  391.     #define CRONEXIT    4   /* Shut down TPTCron */
  392.     #define WHENEVENT   5   /* Check the time for an event */
  393.     #define READFILE    6   /* Read a CronTab file */
  394.     #define TABLIST     7   /* List the CronTab events */
  395.  
  396. 'minutes' is the number of minutes before you want the event to occur
  397. and 'command' is a string containing the command to be executed.
  398.  
  399. CronEvent returns the following result codes:
  400.  
  401.     #define CNOERR       0L /* Command was successful */
  402.     #define OUTOFMEM    -1L /* Error allocating memory */
  403.     #define BADSYNTAX   -2L /* Invalid command type */
  404.     #define NOCRON      -3L /* TPTCron is not active */
  405.     #define TABNOTFOUND -4L /* CronTab file not found */
  406.     #define NOEVENTS    -5L /* There are no events present */
  407.  
  408. The command types DELEVENT and WHENEVENT return special result codes.
  409. A DELEVENT command returns the number of events that were deleted.
  410. A WHENEVENT command returns a time-encoded long that is suitable for calling
  411. ctime() with, or a NULL if the event was not found.
  412.  
  413. Cron.h contains the #define statements mentioned above.  It also declares
  414. CronEvent() as returning a long.
  415.  
  416. CronTest.c is a simple program that uses _CronEvent.o and Cron.h to interact
  417. with TPTCron.
  418.  
  419.  
  420.  
  421. TELEPRO TECHNOLOGIES
  422. -----------------------------------------------------------------------
  423. TelePro Technologies is a company devoted to producing the finest possible
  424. telecommunication and electronic mail software for the Commdore Amiga.
  425.  
  426. TelePro Technologies is currently developing DIALOG, a bulletin board
  427. system for the Commodore Amiga. When completed, DIALOG will be the finest,
  428. most complete program of its type. Features of DIALOG include:
  429.  
  430. > very low memory usage. Under typical load, DIALOG will consume around 30K
  431.   to 50K of memory. If you configure DIALOG to have no screen, then there
  432.   is 0K of chip RAM utilized.
  433.  
  434. > Adherence to FidoNet message standards makes interfacing the program to
  435.   existing packers and mailers a breeze. FidoNet standard message threading
  436.   is also completely supported.
  437.  
  438. > The software is UUCP-friendly in that it will transfer UUCP calls over
  439.   to the appropriate software.  This allows a 24hr BBS to be run concurrently
  440.   with UUCP traffic.  The ability to read and write UUCP mail and participate
  441.   in UseNet newsgroups is in the works.
  442.  
  443. > File transfers with all of the most popular file transfer protocols. We
  444.   currently support Xmodem, Xmodem 1K, and Ymodem. We also support XPR
  445.   library protocols - our BBS will never lack the latest in file transfer
  446.   technology. The BBS currently supports the Zmodem XPR library.
  447.  
  448. > Unlimited number of message areas. Unlimited number of messages in each
  449.   area. Unlimited file areas. You can set up a board as large or as small as
  450.   you desire.
  451.  
  452. > Multi-Line/Multi-User support. Features include on-line conferencing -
  453.   users are able to establish conference "rooms" on-line, and engage in
  454.   multi-participant conversations. Planned features include multi-player
  455.   on-line gaming.
  456.  
  457. > Extra fast operation, and familiar, easy to use interface. Planned is
  458.   a full intuition user-interface for Sysop maintenance. On-line control
  459.   of all BBS operations is now implemented for sysop and co-sysop
  460.   maintenance.
  461.  
  462. > Infinite user-levels. You can exactly the configure the access of each
  463.   user to each area of your BBS, or set areas for maintenance free auto-
  464.   access. In addition, each user can select which areas of your board that
  465.   they want to see. Totally Sysop and user friendly.
  466.  
  467. > Infinitely expandable with external programs and games that use standard
  468.   CLI interfaces.
  469.  
  470. We are currently running a development system at (306) 249-2352. It runs 24
  471. Hours a day, 300/1200/2400/9600/14400 baud HST. There is no validation
  472. period required - you will have full access on your first call. If you are
  473. interested in our product, give it a call and try it out.
  474.  
  475.  
  476. TPTCron was developed to work in conjunction with DIALOG, and is
  477. used for scheduling daily FidoNet events, user time limits, and other
  478. miscellaneous timing tasks required in the operation of a BBS.
  479.  
  480.  
  481.  
  482. If you wish to contact the author of TPTCron via UUCP, Mike Oliphant can
  483. be reached at:
  484.  
  485. dvinci!telepro!oliphant
  486.